package com.ebelter.bodyfatscale.ui.pager.register;

import android.content.Context;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.ebelter.bodyfatscale.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 性别页
 */

public class SexPager extends BasePager {
    @BindView(R.id.rg_sex_pager)
    RadioGroup rgSex;
    @BindView(R.id.rb_male_pager)
    RadioButton rb_male_pager;
    @BindView(R.id.rb_female_pager)
    RadioButton rb_female_pager;
    private int sex;

    public SexPager(Context context,int sex) {
        super(context);
        this.sex=sex;
        setSex(sex);
    }

    @Override
    protected int loadLayoutById() {
        return R.layout.pager_sex;
    }

    @Override
    public void initViews() {
       // rgSex = mRootView.findViewById(R.id.rg_sex_pager);
        ButterKnife.bind(this,mRootView);
        setSex(sex);
    }



    /**
     * 获取性别 1是男 2是女
     */
    public int getSexValue() {
        return rgSex.getCheckedRadioButtonId()==R.id.rb_male_pager?0:1;
    }

    public void setSex(int sex){
        this.sex=sex;
        if (rgSex!=null){
            rgSex.check(sex==0?rb_male_pager.getId():rb_female_pager.getId());
        }
    }

}
